package com.atguigu.practice;

import java.util.Scanner;
import java.util.Stack;

public class Shuffle {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int T=scanner.nextInt();//组数
        while(T>0){
            int n=scanner.nextInt(); //牌有2n张
            int k=scanner.nextInt(); //洗牌次数
            int[] arr=new int[2*n]; // 存放牌
            for(int i=0;i<2*n;i++){
                arr[i]=scanner.nextInt();
            }
            //进行洗牌
            while(k>0){
                shuffle(arr,n);
                k--;
            }
            T--;
            for(int i=0;i<2*n;i++){
                System.out.print(arr[i]+" ");
            }
            System.out.println();
        }
    }
    public static void shuffle(int[] a,int n){
        int[] left=new int[n];
        int[] right=new int[n];
        Stack<Integer> stack=new Stack<>();
        //存放值
        for(int i=0;i<n;i++){
            left[i]=a[i];
        }
        for(int i=n;i<2*n;i++){
            right[i-n]=a[i];
        }
        //进行压栈
        while(n!=0){
            stack.push(right[n-1]);
            stack.push(left[n-1]);
            n--;
        }
        while(!stack.isEmpty()){
            a[n]=stack.pop();
            n++;
        }
    }
}
